﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CastleOfTheDisillusioned {
	static class Utilities {
		//Randomly picks one from source and puts it in new list.
		public static List<T> Shuffle<T>(IEnumerable<T> src) {
			List<T> Source = new List<T>();
			foreach (T itm in src) {
				Source.Add(itm);
			}

			List<T> Dest = new List<T>();
			for (int i = Source.Count() - 1; i >= 0; i--) {
				int Index = Program.Random.Next(0, i + 1);
				T item = Source[Index];
				Source.RemoveAt(Index);
				Dest.Add(item);
			}

			return Dest;
		}
	}
}
